package logic

import (
	"fmt"
	"limutex/api/internal/types"
)

func DeadLock() string {
	var c types.Counter
	c.Lock()
	defer c.Unlock()
	c.Count++
	return foo(c) // 复制锁
}

// 这里Counter的参数是通过复制的方式传入的
func foo(c types.Counter) string {
	c.Lock()
	defer c.Unlock()
	return fmt.Sprintf("in foo")
}
